package day07.zuoye.One;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HiINC[] hi = new HiINC[n];
        for (int i = 0; i < n; i++) {
            String type = sc.next();
            if (type.equals("bicycle")) {
                hi[i] = new Bicycle(sc.next());
            } else {
                hi[i] = new Car(sc.next(), sc.nextDouble());
            }
        }
        double rent = HiINC.calculateRent(hi, sc.nextInt());
        System.out.printf("%.2f", rent);
    }
}
